home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / C / LSAM.ZIP / LSAM.DOC < prev    next >
Encoding:
Text File  |  1988-02-22  |  40.9 KB  |  828 lines

  1.                    GL    S  A  M
  2.         ___________________________________________
  3.            |- - - Lydian Software  Access  Method - - -|
  4.            |- - -      Free Demo  Version 2.02     - - -|
  5.            |- - -        USER DOCUMENTATION          - - -|
  6.            |- - -         CONTENTS          - - -|
  7.            |___________________________________________|
  8.  
  9.  
  10.            Notice to users ..................  0
  11.            Introduction .....................  1
  12.            System overview ..................  2
  13.            System requirements ..............  4
  14.            Storage requirements .............  5
  15.            Function summary .................  6
  16.            Header files .....................  7
  17.            Function descriptions ............  8
  18.            Linking programs ................. 11
  19.            Support programs ................. 12
  20.            Runtime control variables ........ 15
  21.                 GL  S    A  M
  22.         ___________________________________________
  23.            |- - - Lydian Software  Access Method  - - -|
  24.            |- - -      Free Demo  Version 2.02     - - -|
  25.            |- - -        USER DOCUMENTATION          - - -|
  26.            |- - -          NOTICE TO USERS          - - -|
  27.            |___________________________________________|
  28.  
  29.                    page 0H
  30.  
  31.     You have received a disabled version of LSAM with this documen-
  32.     tation.  REGARDLESS OF WHAT MAY BE STATED ELSEWHERE IN THIS DOC-
  33.     UMENT, THE SYSTEM WILL ALLOW ONLY 3 (THREE) INDEX FILES TO BE
  34.     ALLOCATED.  This will serve to allow the user to try the system
  35.     in a simple 'test' application.  Any attempt at usage of this
  36.     demo beyond 3 index files will result in a return of RMAXFIL to
  37.     the 'test' application (though many 'production' applications will
  38.     require a total of 3 or fewer indices for 1 to 3 base files).  You
  39.     may feel free to use this demo system free of charge and to dis-
  40.     tribute the RTL and associated parm files to any of your friends
  41.     and/or users without obligation.  Should you find this product of use
  42.     and wish to purchase a full-function, licensed copy, or if you wish
  43.     more information, you should contact me via CompuServe's EasyPlex
  44.     or GEnie's mail:
  45.                 Craig J. Starr
  46.                 d/b/a Lydian Software
  47.                 CompuServe userid 72617,1345
  48.                 GEnie mail address C.STARR
  49.  
  50.     I will be happy to answer any of your questions.  The software will pro-
  51.     bably be available soon via SOFTEX.  Arrangements are not complete at
  52.     the moment.  If you contact me, I will be happpy to provide you with the
  53.     latest details regarding availability and PRICE, WHICH I WILL MAKE EVERY
  54.     EFFORT TO HOLD BELOW THE $80.00 LEVEL FOR THIS RELEASE.
  55.                 GL  S    A  M
  56.         ___________________________________________
  57.            |- - - Lydian Software  Access Method  - - -|
  58.            |- - -      Free Demo  Version 2.02     - - -|
  59.            |- - -        USER DOCUMENTATION          - - -|
  60.            |- - -           INTRODUCTION          - - -|
  61.            |___________________________________________|
  62.  
  63.                    page 1H
  64.  
  65.     LSAM (Lydian Software Access Method) V2.02 is an indexed sequential
  66.     (ISAM) file access method implemented as a runtime library accessed
  67.     through a set of interface subroutines for users of Microsoft (3.x +)
  68.     compilers.  Its price is significantly below that of the lowest discoun-
  69.     ted-price b+tree indexed file access method packages available up to
  70.     now, but its function and ease of use make it formidable competition
  71.     for it's higher-priced cousins.  It is an ideal choice for the appli-
  72.     cation programmer who needs a full-function, high-performance indexed
  73.     file access method at a reasonable price.
  74.  
  75.     It features support for multiple indices per base file, insertion,
  76.     deletion (logical), retrieval and update by 'key', and full (logical)
  77.     sequential processing capability in both directions, including (re-)
  78.     positioning of a file's internal current record pointer for sequential
  79.     processing of a record (or group of records) beginning at any logical
  80.     record location in the file.  For a more detailed discussion of the
  81.     particulars of the system's function and logic, see the section entitled
  82.     'SYSTEM OVERVIEW.'
  83.  
  84.     LSAM is supplied in the form of 4 relocatable object libraries, one for
  85.     each of the standard memory models supported by Microsoft C 3.x, 1 exe-
  86.     cutable overlay module (referred to as 'the runtime'), 5 ASCII text
  87.     files (three containing required source statements, one containing sam-
  88.     ple source for a typical parameter file generation, one containing this
  89.     documentation), and 2 standalone programs which support the generation
  90.     and formatted display of the binary image parameter files used to define
  91.     the attributes of the base/index file combinations to the runtime system,
  92.     all compressed into a '.arc' format file by the program "ARC", which
  93.     must be used to extract them.  There are 12 files supplied in total.
  94.  
  95.     The files contained in this archive are:
  96.  
  97. G
  98.      system files ---------------------------------------------------------
  99.      *** files required for compiling, linking and generating    ***
  100.      *** programs and data which will make use of the LSAM system***
  101.           slsam4.lib       system subroutine library - 4.0 small model
  102.           clsam4.lib       system subroutine library - 4.0 compact model
  103.           mlsam4.lib       system subroutine library - 4.0 medium model
  104.           llsam4.lib       system subroutine library - 4.0 large model
  105.           slsam5.lib       system subroutine library - 5.0 small model
  106.           clsam5.lib       system subroutine library - 5.0 compact model
  107.           mlsam5.lib       system subroutine library - 5.0 medium model
  108.           llsam5.lib       system subroutine library - 5.0 large model
  109.           lsam.rtl       system runtime support library
  110.           genparm.exe       system parameter file generation utility
  111.           parmlist.exe       system parameter file display utility
  112.           lsam.h       required header file (user data structures)
  113.           lsrcodes.h       required header file (return code #defines)
  114.           lslimits.h       required header file (key, path length ctl)
  115.           lsam.doc       this documentation
  116.      demo files -----------------------------------------------------------
  117.      *** a sample program, plus sample data and parm file inputs ***
  118.      *** see comment header in bkup.c for usage and suggestions  ***
  119.           bkup.c       sample source (a backup) using LSAM calls
  120.      pgm      bkup.exe       sample executable program for bkup.c above
  121.           sample.txt       sample parameter file ASCII source
  122.      input      sample.bin       sample generated binary parameter file
  123.      input      sample.dat       sample data file (as specified in sample.txt)
  124.           sampleb.txt       sample backup parameter file ASCII source
  125.      input      sampleb.bin       sample backup generated binary parameter file
  126. H
  127.                 GL  S    A  M
  128.         ___________________________________________
  129.            |- - - Lydian Software  Access Method  - - -|
  130.            |- - -      Free Demo  Version 2.02     - - -|
  131.            |- - -        USER DOCUMENTATION          - - -|
  132.            |- - -         SYSTEM  OVERVIEW          - - -|
  133.            |___________________________________________|
  134.  
  135.                    page 2H
  136.  
  137.     LSAM is composed of two major components, a runtime support 'overlay'
  138.     module and a subroutine function-request interface package.  The sub-
  139.     routines are the only code linked into the application program.  The
  140.     'runtime' support code is loaded into dynamically allocated storage
  141.     on the first 'open' call (ls_open()).  It is subsequently called at its
  142.     various entry points whenever one of the LSAM subroutines is called,
  143.     passing the appropriate request parameters.  At system exit time, it
  144.     is then called with a request to free any storage it has allocated, and
  145.     when this call returns, the storage allocated for loading the runtime
  146.     code is returned to DOS.  The runtime code is thus technically a 'part-
  147.     time' runtime library (RTL), since it occupies storage only from the
  148.     application's first open call until the application calls the system
  149.     exit routine ls_exit() (this is why IT IS IMPERATIVE THAT ANY CALLS TO
  150.     EXIT() WHICH WOULD BE ISSUED AFTER THE FIRST OPEN CALL BE REPLACED BY
  151.     CALLS TO LS_EXIT() ).  The benefits of this approach are that 1) the 20+K
  152.     of code in the RTL is NOT LINKED INTO ANY APPLICATION PROGRAM which
  153.     uses it, saving on application code disk space requirements, and 2) en-
  154.     hancements, updates, and fixes to the RTL do not require recompilation
  155.     of existing application programs, but rather shipment of a revised RTL
  156.     to application developers, who may in turn ship copies to the licensed
  157.     users of their systems.
  158.  
  159.     LSAM is implemented with a 'separate index' philosophy.  That is, it
  160.     does not intermingle the ind(ex/ices) and the user's data, which remains
  161.     as a standard sequential binary (fixed-length record - ver. 2.02) file,
  162.     capable of being processed as such by any non-LSAM application.  Since
  163.     LSAM is not 'wired-in' to the user's data, it may easily be fitted to
  164.     existing applications with existing user data files with NO CONVERSION
  165.     OF DATA REQUIRED, by simply generating the required parm file(s) and re-
  166.     placing I/O routine calls with the corresponding LSAM subroutine calls.
  167.  
  168.     LSAM can open (or create, if [it does/they do] not exist) and use any
  169.     number of indices for any number of base files (within the confines of
  170.     available storage - see 'STORAGE REQUIREMENTS').  Logical record length
  171.     may be up to 64K (65536) bytes, but must be of fixed length for rel. 2.02.
  172.     Keys are limited to a total of 255 bytes in length, and may be 'split,'
  173.     i.e. comprised of multiple non-contiguous fields in the user record.
  174.     The b+tree index management internals in the runtime system can support
  175.     index entries for files of up to 2 ** 32 (4,294,967,296) user logical
  176.     records.  However, the multiple base file seeks required for relative
  177.     byte offsets greater than the number above have not yet been implemented
  178.     in the LSAM functions to which the user has access, so the current
  179.     practical upward limit is ((2 ** 32) / (user lrecl)) records.  The
  180.     system is parameter-file driven in that it uses, for each base/index
  181.     file group, a generated binary image file, which tells LSAM the charac-
  182.     teristics of the data and index files it will open and process, such as
  183.     the file/index pathname, logical record length, location in the logical
  184.     record of key field(s), and several other attributes, discussed in full
  185.     under the section entitled 'SUPPORT PROGRAMS.'  This allows the program-
  186.     mer to isolate from the application such details as key field length
  187.     and position, file name, path name, and other information which may
  188.     change periodically, without being required to recode or recompile
  189.     the application program.
  190.                 GL  S    A  M
  191.         ___________________________________________
  192.            |- - - Lydian Software  Access Method  - - -|
  193.            |- - -      Free Demo  Version 2.02     - - -|
  194.            |- - -        USER DOCUMENTATION          - - -|
  195.            |- - -         SYSTEM  OVERVIEW          - - -|
  196.            |___________________________________________|
  197.  
  198.                    page 3H
  199.  
  200.     LSAM's control blocks are built at base/index file set open time
  201.     from binary parameter files (one each per base/index file set).  The
  202.     open routine returns a pointer to an internal control block, which the
  203.     user will pass to the various other interface routines along with other
  204.     parameters.  The binary parameter files are generated by the standalone
  205.     program genparm.exe using ASCII text source input similar in format to
  206.     the 'keyword=parm,keyword2=parm2' format characteristic of IBM mainframe
  207.     system software generation/configuration macros, although somewhat more
  208.     free form.  The parameters and their coding requirements are documented
  209.     more fully under the section 'SUPPORT PROGRAMS.'  Sample text for such a
  210.     parameter file (sample.txt) is included in the package.
  211.                 GL  S    A  M
  212.         ___________________________________________
  213.            |- - - Lydian Software  Access Method  - - -|
  214.            |- - -      Free Demo  Version 2.02     - - -|
  215.            |- - -        USER DOCUMENTATION          - - -|
  216.            |- - -       SYSTEM  REQUIREMENTS       - - -|
  217.            |___________________________________________|
  218.  
  219.                    page 4H
  220.  
  221.     Application developers using LSAM will require (on their own and their
  222.     target user systems):
  223.  
  224.         128K RAM Minimum (assuming no add-on memory-resident programs
  225.                   and a very small LSAMIXALLOC value)
  226.         DOS 3.0 or higher
  227.         ** A hard disk is also preferred but not required
  228.  
  229.     Developers themselves will require:
  230.  
  231.         Microsoft C compiler (release 4.0 or higher)
  232.                 GL  S    A  M
  233.         ___________________________________________
  234.            |- - - Lydian Software  Access Method  - - -|
  235.            |- - -      Free Demo  Version 2.02     - - -|
  236.            |- - -        USER DOCUMENTATION          - - -|
  237.            |- - -       STORAGE REQUIREMENTS       - - -|
  238.            |___________________________________________|
  239.  
  240.                    page 5H
  241.  
  242.     The user (application programmer) controls the ultimate (potential)
  243.     storage requirements of LSAM through the DOS environment variable
  244.     LSAMIXALLOC, which (see section entitled 'RUNTIME CONTROL VARIABLES')
  245.     specifies the number of index control blocks to allocate at startup
  246.     time.  The storage required for each control block is, in version 2.02,
  247.     36 bytes.  In addition, buffers totaling either 3K, 6K, or 12K are
  248.     allocated at open time for each index file opened by the runtime system,
  249.     depending on the length of the key (keylengths 1-64 cause 3K of buffers
  250.     to be allocated, keylengths 65-128 will use 6K of buffers, and 129-255
  251.     will use 12K of buffers).  These factors must be considered in planning
  252.     the design of any application system which is to make effective use of
  253.     LSAM.
  254.  
  255.     As an example, if the largest application your user will run uses 16 in-
  256.     dex files and they will all be open at the same time and have keylengths
  257.     less than 65, control blocks will require 16 times 36 bytes = 576 bytes
  258.     for internal control blocks (allocated as a block at startup), plus
  259.     16 times 3K bytes = 49152 bytes for buffer space, for a total allocation
  260.     of 49728 bytes in addition to the requirements (check your program with
  261.     Microsoft's EXEMOD utility) of your program and the roughly 30K
  262.     bytes required for the load of the runtime system:
  263.  
  264.                16 ctl blocks      576 bytes
  265.                16 3K buffers    49152 bytes
  266.                runtime stge.    30000 bytes
  267.                avg user pgm.    25000 bytes
  268.                     -----
  269.                total required  104728 bytes for this application
  270.                 GL  S    A  M
  271.         ___________________________________________
  272.            |- - - Lydian Software  Access Method  - - -|
  273.            |- - -      Free Demo  Version 2.02     - - -|
  274.            |- - -        USER DOCUMENTATION          - - -|
  275.            |- - -         FUNCTION SUMMARY          - - -|
  276.            |___________________________________________|
  277.  
  278.                    page 6H
  279.  
  280.     The following is a list of the functions available to the user of
  281.     the LSAM system.  Full descriptions follow in the FUNCTION DESCRIPTION
  282.     section.
  283.  
  284. void ls_bldixkey();   /* build key string service for non-contiguous keys */
  285. int  ls_is_ix_new(),  /* returns YES if selected ix created by this run, else NO */
  286.      ls_bldindx(),    /* build index file for given base file */
  287.      ls_startbr(),    /* (re)set internal current record pointer for seq read */
  288.      ls_read(),       /* 'key' read - 'random' retrieval of logical record */
  289.      ls_readnext(),   /* sequential read (next) logical record, given index */
  290.      ls_readprev(),   /* sequential read (prev) logical record, given index */
  291.      ls_write(),      /* write new record */
  292.      ls_rewrite(),    /* update existing record */
  293.      ls_delete(),     /* delete existing record */
  294.      ls_close(),      /* close base/index file set */
  295.      lsam();          /* dummy call to force linker inclusion of lsam module */
  296. LSBFPP ls_open();     /* open base/index file set using generated parm file */
  297.                 GL  S    A  M
  298.         ___________________________________________
  299.            |- - - Lydian Software  Access Method  - - -|
  300.            |- - -      Free Demo  Version 2.02     - - -|
  301.            |- - -        USER DOCUMENTATION          - - -|
  302.            |- - -           HEADER FILES          - - -|
  303.            |___________________________________________|
  304.  
  305.                    page 7H
  306.  
  307.     Three header files are supplied with LSAM: "lsam.h", "lsrcodes.h", and
  308.     "lslimits.h", which are to be included via the #include compiler
  309.     directive in any source modules which make reference to any LSAM
  310.     function or symbolic name (i.e. a manifest constant such as the return
  311.     code constant value RGOOD).  Since LSAM.H contains '#include's for
  312.     LSRCODES.H and LSLIMITS.H, the application programmer need only code the
  313.     required '#include' for LSAM.H.  Put these files in a subdirectory which
  314.     the compiler will search when it compiles your programs.
  315.  
  316.     LSAM.H contains the data structure definitions and symbolic constants
  317.     for various request parameter values required to use LSAM, plus the
  318.     declarations of all the functions available in the system.
  319.  
  320.     LSRCODES.H contains the symbolic constants (#defines) for the LSAM
  321.     system return codes.  Since these values may change in a future re-
  322.     lease, the user is STRONGLY advised to USE THE NAMES when testing re-
  323.     turn codes for specific values.  They will not change from release
  324.     to release.  This will simplify maintenance to your source when
  325.     upgrading to a future release.
  326.  
  327.     LSLIMITS.H contains the symbolic constants (#defines) for the LSAM
  328.     field size limits: maximum keylength and maximum pathname length.  As
  329.     with LSRCODES.H above, the user would be well advised to use these
  330.     symbolic names rather than hard-code numeric values, for the same
  331.     common-sense reasons of maintainability.
  332.                 GL  S    A  M
  333.         ___________________________________________
  334.            |- - - Lydian Software  Access Method  - - -|
  335.            |- - -      Free Demo  Version 2.02     - - -|
  336.            |- - -        USER DOCUMENTATION          - - -|
  337.            |- - -      FUNCTION  DESCRIPTIONS      - - -|
  338.            |___________________________________________|
  339.  
  340.                    page 8H
  341.  
  342.     By using the interface subroutine oriented approach, most calls to
  343.     the LSAM functions simply pass the LSBFPP pointer, an index no., key,
  344.     and the system routines take care of the required control block manipu-
  345.     lation, thereby simplifying the programmer's task.
  346.  
  347.     Zero return codes are OK for all except ls_open(), which should return
  348.     the address of the control block it allocates.    Other return codes re-
  349.     present error conditions and should be handled appropriately (with the
  350.     exception of REOF, which may be ignored if the programmer desires to
  351.     "wrap-around" to the logical beginning or end of the file).
  352.  
  353. lsam()         /* dummy call */
  354.  
  355.     This function is a do-nothing routine supplied to en-
  356.     able the user to force the linker to include the lsam.obj module which
  357.     contains all of the routines described below.  The user simply codes a
  358.     dummy routine which calls lsam(), then NEVER CALLS THIS DUMMY routine.
  359.     The linker automatically will include the lsam.obj module.
  360.     There is no harm done, other than the waste of a few machine cycles, if
  361.     the user inadvertently calls lsam().  It will just return.
  362.  
  363.     Example of dummy call usage:
  364.  
  365.     dummy()     /* This routine is NOT called anywhere in pgm */
  366.     {
  367.         lsam(); /* This will fool the linker into including lsam.obj */
  368.     }
  369.  
  370.             As an alternative to a dummy call,
  371.             the user may (must) specify the name
  372.             'lsam' explicitly to the linker, in the
  373.             object modules list, which means, of
  374.             course, that lsam.obj must be extracted
  375.             from lsam.lib with lib.exe (Microsoft or
  376.             equivalent object library manager) prior
  377.             to linking in this alternative manner.
  378.  
  379.  
  380. int ls_is_ix_new(base,ix)     /* RETURNS YES IF INDEX WAS CREATED BY THIS RUN */
  381. LSBFPP base;              /* pointer to base file info structure */
  382. UINT ix;              /* relative subscript of index selected */
  383.  
  384.     ls_open() sets internal control codes for each index file successfully
  385.     opened.  Use this routine to check the status of a particular index file
  386.     to determine if it was just created.  The routine ls_bldindx() also
  387.     checks this status and exits if it is not YES.    Should you wish to re-
  388.     build an existing index file, you must delete it from DOS before running
  389.     your application program, which should have a call to this routine and
  390.     a corresponding conditional call to ls_bldindx() for each index file you
  391.     wish to rebuild.  Usage example:
  392.  
  393.         if(ls_is_ix_new(base,ix) == YES) /* did LSAM just create this ix ?*/
  394.         ls_bldindx(base,ix);         /*   then ask LSAM to build it */
  395.  
  396. int ls_bldindx(base,ix) /*CREATES AND BUILDS AN INDEX FILE FOR GIVEN BASE FILE*/
  397. LSBFPP base;              /* pointer to base file info structure */
  398. UINT ix;              /* relative subscript of index to be built */
  399.  
  400.     Value "ix" is the table subscript of the index to build.  Valid values
  401.     are 0 through the number of indices you 'genned' in your parameter file
  402.     minus 1 (i.e. they are relative subscript numbers) and CORRESPOND DIRECT-
  403.     LY to the order in which you specified them in the text of the parm file.
  404.  
  405.   NOTE: ls_open() sets internal control codes for each index file successfully
  406.     opened.  ls_bldindx() checks one of these before proceeding and exits if
  407.     it indicates that the index file is not new/empty.
  408.                 GL  S    A  M
  409.         ___________________________________________
  410.            |- - - Lydian Software  Access Method  - - -|
  411.            |- - -      Free Demo  Version 2.02     - - -|
  412.            |- - -        USER DOCUMENTATION          - - -|
  413.            |- - -      FUNCTION  DESCRIPTIONS      - - -|
  414.            |___________________________________________|
  415.  
  416.                    page 9H
  417.  
  418. void ls_bldixkey(base,ix,key) /*BUILD INDEX KEY FIELD FROM RECORD KEY FIELD(S)*/
  419. LSBFPP base;                /* pointer to base file info structure */
  420. UINT ix;                /* relative subscript of index to be used */
  421. UCHAR *key;                /* pointer to user key work array */
  422.  
  423.     Since the functions which require keys take a single address value for
  424.     the key, it is necessary to concatenate any split key sub-fields before
  425.     calling a routine which requires a key field address.  This routine
  426.     uses register pointer variables and is very fast.  THIS ROUTINE IS OF
  427.     NO USE FOR ANY OF YOUR INDICES FOR WHICH THE RECORD KEY IS ONE CONTI-
  428.     GUOUS AREA IN THE RECORD.  FOR SUCH KEYS, THE ADDRESS OF THE KEY FIELD
  429.     WITHIN THE USER RECORD IS A VALID KEY POINTER, AND YOU WILL SAVE THE
  430.     PROCESSING OVERHEAD OF THIS CALL.
  431.  
  432.   NOTE: This special function provides a service to concatenate split
  433.     key sub-fields from a user record into a user key work area, the
  434.     address of which may then be passed to any LSAM routine requiring
  435.     a key field address.  User key work area(s) MUST BE LONG ENOUGH
  436.     to contain the key length used by the index referenced in the call.
  437.     This routine can NOT verify user key work area length, and will write
  438.     until all key sub-fields are copied, potentially clobbering adjacent
  439.     data.  To play it safe, you can make your key field work area(s) 256
  440.     bytes long, one byte longer than the maximum key length (255), which
  441.     the parameter file generation program 'genparm.exe' dictates.
  442.  
  443. int ls_startbr(base,ix,key,stype) /* START BROWSE - POSITION IN FILE VIA IX */
  444. LSBFPP base;              /* pointer to base file info structure */
  445. UINT ix;              /* relative subscript of index to be used */
  446. UCHAR *key;              /* pointer to user key work array */
  447. UCHAR stype;              /* type of start: GTEQ or EQUAL */
  448.  
  449.     (High-order, i.e. leftmost) Partial keys may be used if stype = GTEQ is
  450.     specified.  Position will be at logical record with next greater or
  451.     equal record key value.  Return will be RGOOD regardless of whether
  452.     the key found is greater than or equal to the requested key field.
  453.     If EQUAL is specified, full key should be supplied because the runtime
  454.     searches for an EXACT match.  In this case, if an exact match is not
  455.     found, the runtime returns RNOTFND and the current record pointer
  456.     remains where it was.
  457.  
  458. int ls_read(base,ix,key)      /* READ 'RANDOM' BY KEY */
  459. LSBFPP base;              /* pointer to base file info structure */
  460. UINT ix;              /* relative subscript of index to be used */
  461. UCHAR *key;              /* pointer to user key work array */
  462.  
  463. int ls_readnext(base,ix)      /* READ NEXT LOGICALLY SEQ. FILE RECORD */
  464. LSBFPP base;              /* pointer to base file info structure */
  465. UINT ix;              /* relative subscript of index to be used */
  466.  
  467.     Return value REOF may be ignored if desired.  The first logical record
  468.     in the dataset will be in the user record area on return.
  469.  
  470. int ls_readprev(base,ix)      /* READ PREV LOGICALLY SEQ. FILE RECORD */
  471. LSBFPP base;              /* pointer to base file info structure */
  472. UINT ix;              /* relative subscript of index to be used */
  473.  
  474.     Return value REOF may be ignored if desired.  The last logical record in
  475.     the dataset will be in the user record area on return.
  476.                 GL  S    A  M
  477.         ___________________________________________
  478.            |- - - Lydian Software  Access Method  - - -|
  479.            |- - -      Free Demo  Version 2.02     - - -|
  480.            |- - -        USER DOCUMENTATION          - - -|
  481.            |- - -      FUNCTION  DESCRIPTIONS      - - -|
  482.            |___________________________________________|
  483.  
  484.                    page 10H
  485.  
  486. int ls_write(base)          /* WRITE A NEW RECORD */
  487. LSBFPP base;              /* pointer to base file info structure */
  488.  
  489.     Appends a new record to the base dataset, and inserts an index entry
  490.     into ALL indices for which the UPGRADE=yes option was specified in
  491.     its parameter file generation.    If UNIQUEKEY=yes was specified in
  492.     its parameter file, error RDUPKEY is returned if an entry for the
  493.     key is already present in an index for which UPGRADE=yes is in effect.
  494.  
  495. int ls_rewrite(base,ix,key)      /* REWRITE AN EXISTING RECORD */
  496. LSBFPP base;              /* pointer to base file info structure */
  497. UINT ix;              /* relative subscript of index to be used */
  498. UCHAR *key;              /* pointer to user key work array */
  499.  
  500. int ls_delete(base,ix,key)      /* DELETE AN EXISTING (INDEX) RECORD */
  501. LSBFPP base;              /* pointer to base file info structure */
  502. UINT ix;              /* relative subscript of index to be used */
  503. UCHAR *key;              /* pointer to user key work array */
  504.  
  505.     This is a 'logical' delete.  ONLY THE SELECTED INDEX RECORD IS DELETED,
  506.     thereby allowing a measure of recovery (by rebuilding the index file).
  507.  
  508. LSBFPP ls_open(parm,env_or_name,mode,recptr) /*OPEN BASE FILE & RELATED INDICES*/
  509. UCHAR *parm;              /* pointer to parm file ENV VAR or NAME */
  510. int env_or_name;          /* switch (YES/NO) is parm ENV or NAME ? */
  511. UCHAR *mode;              /* mode same as fopen() - 'BINARY' SEE DOC. */
  512. UCHAR *recptr;              /* address of user record area */
  513.  
  514.     If the base file open succeeds, this function attempts to open all
  515.     related index files.   All buffers required for each index group are
  516.     allocated by the runtime system at this time.  The user MUST specify
  517.     a binary-mode open for this call (e.g. "w+b" "r+b" "wb" "rb" - see
  518.     fopen()).  If not, base file positioning is NOT guaranteed to be
  519.     accurate.
  520.  
  521.     NOTE: ON THE FIRST CALL TO ls_open(), THE RUNTIME CODE IS LOADED. ANY
  522.           CALLS TO OTHER INTERFACE ROUTINES BEFORE THIS WILL RESULT IN A
  523.           RETURN OF RINITERR (Initialization error, the b+tree runtime
  524.           library code has not been loaded).
  525.  
  526.     NOTE: A NULL (ZERO) RETURN FOR ls_open() IS AN ERROR, AS WITH FOPEN().
  527.     ---------------------------------------------------------------------
  528.  
  529. int ls_close(base)          /* CLOSE BASE FILE AND ITS RELATED INDICES */
  530. LSBFPP base;              /* pointer to base file info structure */
  531.  
  532.     This function will close all related index files for a base dataset,
  533.     then close the base via fclose().  All buffers allocated by the runtime
  534.     system for this index group are de-allocated at this time.  Return
  535.     values are the same as for fclose().
  536.  
  537. int ls_exit()    /*  REQUIRED AS LAST REQUEST -- MUST CALL TO FREE RTL MEMORY */
  538.  
  539.     This function will signal the RTL to release its acquired memory, then
  540.     release the memory into which the RTL was loaded, then call the standard
  541.     C exit routine exit().    It does not return.  RESULTS ARE UNPREDICTABLE
  542.     IF THIS ROUTINE IS NOT CALLED AS YOUR FINAL EXIT.  See the section enti-
  543.     tled 'SYSTEM OVERVIEW' for additional explanation of this requirement.
  544.                 GL  S    A  M
  545.         ___________________________________________
  546.            |- - - Lydian Software  Access Method  - - -|
  547.            |- - -      Free Demo  Version 2.02     - - -|
  548.            |- - -        USER DOCUMENTATION          - - -|
  549.            |- - -         LINKING PROGRAMS          - - -|
  550.            |___________________________________________|
  551.  
  552.                    page 11H
  553.  
  554.     We must assume that the application developer understands the use of
  555.     the MS-DOS linker and the concept of object linking in general.  It is
  556.     beyond the scope of this documentation.  Should the user/programmer be
  557.     unsure of these, he/she is advised to consult the MS-DOS linker documen-
  558.     tation in the MS-DOS reference before reading further under this sec-
  559.     tion.
  560.  
  561.     No matter which linking method you may choose, the library name of the
  562.     LSAM system must be specified to the linker for the 'libraries' entry
  563.     or prompt BEFORE the name(s) of the standard C librar(y/ies), as there
  564.     are calls to standard C library functions in the LSAM subroutine package
  565.     which must be resolved.
  566.  
  567.     Under NO circumstances should you mix memory model libraries.  If you
  568.     are using compact model, for instance, you should use the compact model
  569.     LSAM library 'clsam.'  The naming convention of the libraries, as sup-
  570.     plied, follows that of the Microsoft C libraries in its use of the first
  571.     character of the library name as an abbreviation for the memory model.
  572.     This should help you to avoid potential linking problems resulting from
  573.     linking with an incorrect memory model library.  If you make such an er-
  574.     ror, the linker will respond with a 'segment fixup' error message, which
  575.     should clue you in to the problem.
  576.                 GL  S    A  M
  577.         ___________________________________________
  578.            |- - - Lydian Software  Access Method  - - -|
  579.            |- - -      Free Demo  Version 2.02     - - -|
  580.            |- - -        USER DOCUMENTATION          - - -|
  581.            |- - -         SUPPORT PROGRAMS          - - -|
  582.            |___________________________________________|
  583.  
  584.                    page 12H
  585.  
  586.     Two 'standalone' support programs are supplied with LSAM. Their purpose
  587.     is to perform the generation and formatted display/printout of the para-
  588.     meter files which supply LSAM with the required information about impor-
  589.     tant attributes of each set of data/index file(s).
  590.  
  591.     GENPARM.EXE accepts an ASCII text file of statements describing the
  592.     characteristics of a data (hereafter referred to as 'base') file and its
  593.     related index/indices (there may be more than one index per 'base' file)
  594.     and generates a binary image file in the format required by LSAM to open
  595.     and process the base and its related index/indices.  The syntax of these
  596.     statements is described in detail below.  Usage is:
  597.  
  598.         genparm  [d:][\pathname\]filename[.txt]
  599.  
  600.             where         d:        is drive         (optional)
  601.                      pathname   is pathname      (optional)
  602.                      filename   is parm filename (required)
  603.                      .txt        is extension     (assumed)
  604.  
  605.             Using the syntax rules described below, genparm will
  606.             produce the file [d:][\pathname\]filename.bin which
  607.             will be used by LSAM at base/index file open time and
  608.             in further processing.
  609.  
  610.         GENPARM INPUT TEXT SYNTAX RULES
  611.  
  612.     There is a single macro command recognized by genparm: lsparm.
  613.     The 'type' keyword must be specified first for all types.  All other
  614.     keywords are non-positional (EXCEPT subkeyword 'ixname' for the 'index'
  615.     keyword, which must be the 1st subkeyword for each index file entry).
  616.     Upper, lower or mixed case input is accepted.  Comments may begin any-
  617.     where on a line, and are preceded by either an asterisk ('*') or a semi-
  618.     colon (';') as a comment indicator.  ALL TEXT FOLLOWING A COMMENT INDI-
  619.     CATOR IS IGNORED FOR THE REMAINDER OF THE LINE.  Use of comments is not
  620.     required but is encouraged as a means to simplify maintenance.    Equal
  621.     signs and commas are accepted as delimiters for those of you with the
  622.     IBM (370) macro point of view, but are not required (one or more blanks
  623.     will do instead).  For type=entry, line continuation is indicated by a
  624.     dash ('-'), and is REQUIRED WHEN THE KEYWORDS/PARMS SPILL OVER BEYOND
  625.     ONE LINE.  Keywords and corresponding parameters (and index subkeywords
  626.     and their parms) are signified, for each of its three forms, by the
  627.     value specified for the 'type' keyword:
  628.                 GL  S    A  M
  629.         ___________________________________________
  630.            |- - - Lydian Software  Access Method  - - -|
  631.            |- - -      Free Demo  Version 2.02     - - -|
  632.            |- - -        USER DOCUMENTATION          - - -|
  633.            |- - -         SUPPORT PROGRAMS          - - -|
  634.            |___________________________________________|
  635.  
  636.                    page 13H
  637.  
  638.    -------------------------------------------------------------------- parm -
  639.    macro command  keyword   parameter/value                reqd?
  640.    ---------------------------------------------------------------------------
  641.       lsparm       type      'begin'  (marks beginning of source)       | Yes
  642.    ---------------------------------------------------------------------------
  643.       lsparm       type      'entry'  (marks a base/ix entry)           | Yes
  644.            basename  valid DOS filename [xxxxxxxx.xxx]        | Yes
  645.            drive     valid DOS drive designator [x:]        | No
  646.            path      valid DOS pathname [\xxxx[\xxx]\]        | No
  647.            maxlrecl  max logical record length GT 0 & LT 65537    | Yes
  648.            reclaim   reuse 'deleted' base file space [YES | no] | No
  649.                  before appending any new data records to    |
  650.                  end of base file                |
  651.                *** IGNORED IN 2.02 - RECLAIM ALWAYS 'NO'    |
  652.            recfm     base file recd length is [FIXED | variable]| No
  653.                *** IGNORED IN 2.02 - RECFM ALWAYS 'FIXED'   |
  654.            index   ( subkeywords valid only for index keyword ) | Yes
  655.                *** BEGIN THIS ENTRY/GROUP WITH OPEN PAREN,    |
  656.                    END WITH CLOSE PARENTHESIS.        |
  657.                  -------------------------------------------|
  658.                  ixname    valid DOS filename [xxxxxxxx.xxx]| Yes
  659.                        ('ixname' MARKS BEGINNING OF EACH|
  660.                     INDEX SPECIFICATION, AND SHOULD |
  661.                     BE CODED BEFORE OTHER INDEX SUB-|
  662.                     KEYWORDS)            |
  663.                  ixdrive   valid DOS drive designator [x:]    | No
  664.                  ixpath    valid DOS pathname [\xxxx[\xxx]\]| No
  665.                  keys     ( offset,len,offset,len ... )    | Yes
  666.                  uniquekey key is unique [YES | no]     | No
  667.                        'no' allows duplicate keys       |
  668.                  upgrade   insert key on write [YES | no]    | No
  669.                        'no' bypasses index update on    |
  670.                        write of record to base file    |
  671.    ---------------------------------------------------------------------------
  672.       lsparm       type      'end'    (marks end of source)             | Yes
  673.    ---------------------------------------------------------------------------
  674.     Alternatives/options are indicated in brackets separated by the symbol
  675.     '|' with the default indicated in upper case.
  676.                 GL  S    A  M
  677.         ___________________________________________
  678.            |- - - Lydian Software  Access Method  - - -|
  679.            |- - -      Free Demo  Version 2.02     - - -|
  680.            |- - -        USER DOCUMENTATION          - - -|
  681.            |- - -         SUPPORT PROGRAMS          - - -|
  682.            |___________________________________________|
  683.  
  684.                    page 14H
  685.  
  686.     The following is a typical base/(multiple)index file parameter source
  687.     coding (coded a la IBM 370 mentality w/equal signs and commas, each of
  688.     which could just as easily be replaced by one or more blanks):
  689.  
  690.     ***************************************************************
  691.     *  comment                              *
  692.     *  documenting use of the base/index files specified here      *
  693.     ***************************************************************
  694.     lsparm type=begin
  695.     * either an asterisk (*)
  696.     ; or a semicolon (;) is a valid comment delimiter
  697.     *         comments may occupy an entire line
  698.     lsparm type=entry, -           ; or the final part of a line
  699.        *     comments need not begin in any particular position
  700.        basename=auto.dat, -
  701.        *     and they may separate 'continued' lines
  702.        drive=c:, -               * this is a comment
  703.        path=\c\demo\, -           ; this is also a comment
  704.        maxlrecl=143 -           ;        use comments to document
  705.        reclaim=yes, -
  706.        recfm=fixed, -
  707.        index=(ixname=auto.i00,ixdrive=c:,ixpath=\c\demo\, -
  708.               keys=(2,15,18,11,30,1),uniquekey=yes,upgrade=yes, -
  709.           ixname=auto.i01,ixdrive=c:,ixpath=\c\demo\, -
  710.               keys=(2,15,18,11,30,1),upgrade=yes,uniquekey=yes)
  711.     lsparm type=end
  712.  
  713.     Here is the same parm file, without the 370 macro characteristics, but
  714.     equally acceptable to genparm:
  715.  
  716.     ***************************************************************
  717.     *  comment                              *
  718.     *  documenting use of the base/index files specified here      *
  719.     ***************************************************************
  720.     lsparm type begin
  721.     * either an asterisk (*)
  722.     ; or a semicolon (;) is a valid comment delimiter
  723.     *         comments may occupy an entire line
  724.     lsparm type     entry -           ; or the final part of a line
  725.        *     comments need not begin in any particular position
  726.        basename auto.dat -
  727.        *     and they may separate 'continued' lines
  728.        drive    c: -           * this is a comment
  729.        path     \c\demo\ -           ; this is also a comment
  730.        maxlrecl 143 -           ;        use comments to document
  731.        reclaim  yes -
  732.        recfm    fixed -
  733.        index    (ixname auto.i00 ixdrive c: ixpath \c\demo\ -
  734.               keys (2 15 18 11 30 1) uniquekey yes upgrade yes -
  735.              ixname auto.i01 ixdrive c: ixpath \c\demo\ -
  736.               keys (2 15 18 11 30 1) upgrade yes uniquekey yes)
  737.     lsparm type end
  738.  
  739.         END GENPARM INPUT TEXT SYNTAX RULES
  740.  
  741.  
  742.     PARMLIST.EXE will display (on stdout) a formatted listing of the various
  743.     attributes/parameters in the binary image parameter file generated by
  744.     genparm.exe above.  It is supplied as a convenient method of verifying
  745.     that the attributes/parameters the user specified for a given base/index
  746.     set are in fact what was intended.  Output may, of course, be redirected
  747.     wherever desired, such as to a file or printer.  Usage is:
  748.  
  749.         parmlist [d:][\pathname\]filename[.bin]
  750.  
  751.             where         d:        is drive     (optional)
  752.                      pathname   is pathname  (optional)
  753.                      filename   is filename  (required)
  754.                      .bin        is extension (assumed)
  755.                 GL  S    A  M
  756.         ___________________________________________
  757.            |- - - Lydian Software  Access Method  - - -|
  758.            |- - -      Free Demo  Version 2.02     - - -|
  759.            |- - -        USER DOCUMENTATION          - - -|
  760.            |- - -     RUNTIME CONTROL VARIABLES    - - -|
  761.            |___________________________________________|
  762.  
  763.                    page 15H
  764.  
  765.     Two DOS environment variables are supported for control of the LSAM
  766.     runtime system.  They may be set or reset at any time, due to changing
  767.     needs, and do not require any accompanying program changes.  They are
  768.     most conveniently set in the target user's autoexec.bat or other startup
  769.     batch file.  (See the SET command in the DOS reference).
  770.  
  771.     1)  LSAMRTL should be set to the full path name identifying the
  772.             location of the runtime overlay module 'lsam.rtl.'  This
  773.             variable is REQUIRED.  The system will abort the application
  774.             program if this variable is not found in the environment.
  775.  
  776.     2)  LSAMIXALLOC should be set to the number of index control blocks
  777.             for the runtime system to allocate when it is loaded.  This
  778.             may vary from application to application.  For convenience,
  779.             set it to the largest number of indices (total) used by any
  780.             of your applications.  This number must not exceed 1926, and
  781.             if it does, you should be running your application under
  782.             IDMS or DB2 on an IBM 3090, not with this package on a PC.
  783.             This variable is OPTIONAL, but it DEFAULTS TO 10, which may
  784.             not be adequate.  Therefore, the user is encouraged to set
  785.             it to his/her 'reasonable' limit.  This variable has a di-
  786.             rect bearing on the ultimate storage requirements of this
  787.             system.  See the section entitled 'STORAGE REQUIREMENTS.'
  788.  
  789.  
  790.  
  791.  
  792.                   G**** END ****H
  793.  
  794.          ----------------end-of-author's-documentation---------------
  795.  
  796.                         Software Library Information:
  797.  
  798.                    This disk copy provided as a service of
  799.  
  800.                         The Public (Software) Library
  801.  
  802.          We are not the authors of this program, nor are we associated
  803.          with the author in any way other than as a distributor of the
  804.          program in accordance with the author's terms of distribution.
  805.  
  806.          Please direct shareware payments and specific questions about
  807.          this program to the author of the program, whose name appears
  808.          elsewhere in  this documentation. If you have trouble getting
  809.          in touch with the author,  we will do whatever we can to help
  810.          you with your questions. All programs have been tested and do
  811.          run.  To report problems,  please use the form that is in the
  812.          file PROBLEM.DOC on many of our disks or in other written for-
  813.          mat with screen printouts, if possible.  The P(s)L cannot de-
  814.          bug programs over the telephone.
  815.  
  816.          Disks in the P(s)L are updated monthly, so if you did not get
  817.          this disk  directly from the P(s)L,  you should be aware that
  818.          the files in this set may no  longer be the current versions.
  819.  
  820.          For a copy of the latest monthly software library newsletter
  821.          and a list of the 1,000+ disks in the library, call or write
  822.  
  823.                         The Public (Software) Library
  824.                               P.O.Box 35705 - F
  825.                            Houston, TX 77235-5705
  826.                       (713) 721-6104 or (713) 721-5205
  827.  
  828.